#-----------------------------------[知乎：叶枝黎曼]----------------------------
def exGcd(a,b):
    if b == 0:
        return 1,0,a
    x,y,gcd = exGcd(b,a%b)
    return y,x - a // b * y , gcd

a,b = map(int,input().split())
x,y,gcd = exGcd(a,b)
print(x,y)
